package com.qys.livesMall.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qys.livesMall.common.exception.QysException;
import com.qys.livesMall.system.mapper.BankMapper;
import com.qys.livesMall.system.mapper.WalletMapper;
import com.qys.livesMall.system.modal.entity.Bank;
import com.qys.livesMall.system.service.BankService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 银行表(Bank)表服务实现类
 *
 * @author makejava
 * @since 2023-07-07 13:50:10
 */
@Service("bankService")
public class BankServiceImpl extends ServiceImpl<BankMapper, Bank> implements BankService {

    @Resource
    private WalletMapper walletMapper;
    @Override
    public void removeBank(List<Long> idList) {
        Long count = walletMapper.getWalleSubordinate(idList,0);
        if(count > 0){
            throw new QysException("Bank in use");
        }
        baseMapper.deleteBatchIds(idList);
    }
}

